//
//  RunningViewController.m
//  muscleLife
//
//  Created by xalo on 16/5/4.
//  Copyright © 2016年 HeavenAndHell. All rights reserved.
//

#import "RunningViewController.h"
#import "RunTableViewCell.h"
#import "DisplayTableViewCell.h"
#import "AdjectiveViewController.h"


@interface RunningViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong)UITableView *runTabelView;
//@property (nonatomic,strong)HFStretchableTableHeaderView *headerView;


@end

@implementation RunningViewController

-(UITableView *)runTabelView{
    if (!_runTabelView) {
        _runTabelView=[[UITableView alloc]initWithFrame:self.view.frame];
        _runTabelView.bounces=NO;
    }
    return _runTabelView;
}


//-(void)createView{
//    
//    //背景
//    UIImageView *bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, kControllerHeight/4)];
//    bgImageView.contentMode = UIViewContentModeScaleAspectFill;
//    bgImageView.clipsToBounds = YES;
//    bgImageView.image = [UIImage imageNamed:kBackGroundPlaceholderFileName];
//    //背景之上的内容
//    UIView *contentView = [[UIView alloc] initWithFrame:bgImageView.bounds];
//    contentView.backgroundColor = [UIColor clearColor];
//    self.headerView = [HFStretchableTableHeaderView new];
//    [self.headerView stretchHeaderForTableView:self.runTabelView withView:bgImageView subViews:contentView];
//
//}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets=NO;
    self.navigationItem.title=@"有氧减脂";
    self.runTabelView.delegate=self;
    self.runTabelView.dataSource=self;
     [self.view addSubview:self.runTabelView];
//    [self createView];
    
    [self.runTabelView registerNib:[UINib nibWithNibName:@"RunTableViewCell" bundle:nil] forCellReuseIdentifier:@"RunTableViewCell"];
    [self.runTabelView registerNib:[UINib nibWithNibName:@"DisplayTableViewCell" bundle:nil] forCellReuseIdentifier:@"DisplayTableViewCell"];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark-tableViewDelegateAndDataSource

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row==1) {
        DisplayTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"DisplayTableViewCell" forIndexPath:indexPath];
    cell.sumTimeLabel.text=@"50";
        return cell;
    }
    
    RunTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"RunTableViewCell" forIndexPath:indexPath];
    if (indexPath.row==0) {
        cell.titleRunLabel.text=@"悦跑圈资讯";
        cell.ZixunImageView.image=[UIImage imageNamed:@"red_run"];
    }else if(indexPath.row==2){
        
        cell.titleRunLabel.text=@"开始跑步";
        cell.ZixunImageView.image=[UIImage imageNamed:@"start_run"];
    }
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row==1) {
          return 100;
    }
    return (kControllerHeight-100)/2;
  
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    switch (indexPath.row) {
        case 0:
        {
            AdjectiveViewController *adjectVC=[[AdjectiveViewController alloc]init];
            [self.navigationController pushViewController:adjectVC animated:YES];
        }
            break;
            case 2:
        {
           
        }
            break;
            
        default:
            break;
    }
}
//-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
//    [self.headerView scrollViewDidScroll:scrollView];
// 
//}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
